﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using mylist.domain;
using NHibernate.Mapping.ByCode;
using NHibernate.Mapping.ByCode.Conformist;

namespace mylist.infraestrucure.nhibernate
{
    public class EntityMapping<T> : ClassMapping<T> where T : Entity
    {
        public EntityMapping()
        {
            Id(x => x.Id);
        }
    }

    public class AlbumMapping : EntityMapping<Album>
    {
        public AlbumMapping()
        {
            Property(x => x.Name);
            ManyToOne(x => x.Artist, map => map.Column("ArtistId"));
        }
    }

    public class ArtistMapping : EntityMapping<Artist>
    {
        public ArtistMapping()
        {
            Property(x => x.Name);
        }
    }
}
